<?php

namespace app\admin\controller;

class Cache
{
    /**
     * 缓存操作
     * @return mixed
     */
    public function index()
    {
        $response=app("C_Admin_cache")->getPositionData();
        $positionData = array();
        if ($response["success"]) {
            $positionData = $response["data"];
        }

        $data=array();
        $data["positionData"]=$positionData;
        $data["request"] = request()->param();
        return view("admin/cache/index",$data);
    }

    /**
     * 更新页面
     * @return mixed
     */
    public function update()
    {
        $request=request()->param();
        //获取进度
        $response=app("C_Admin_cache")->update();
        if ($response["success"]) {
            $proccessData = $response["data"];
        }else{
            $proccessData=array(
                "codeMsg"=>$response["codeMsg"],
            );
        }
        //获取数据
        $data=array();
        $data["proccessData"] = $proccessData;
        $data["request"] = $request;
        $data["referer"] = YIFANG_ROUTE_PREFIX."/cache?moduleId=".getVal($request,"moduleId",0);
        return view("admin/cache/update",$data);
    }
}